package com.tomkk.ssm.dao;

import com.tomkk.ssm.po.User;
import org.apache.ibatis.session.SqlSession;
import org.mybatis.spring.support.SqlSessionDaoSupport;


/**
 * @ClassName: UserDAOImpl
 * @Description: 用户信息DAO实现类
 * @author: tomkk
 * @date: 2017-11-17
 */

public class UserDAOImpl extends SqlSessionDaoSupport implements UserDAO {

    public User findUserById(int id) {
        SqlSession sqlSession = this.getSqlSession();
        User user = sqlSession.selectOne("test.findUserById", id);
        return user;
    }

    public void insertUser(User user) throws Exception {
        SqlSession sqlSession = this.getSqlSession();
        sqlSession.insert("test.insertUser");

        sqlSession.commit();
    }
}
